class CreateDiscs < ActiveRecord::Migration
  def self.up
    create_table :discs do |t|
      t.integer :number
      t.string :title
      t.string :format
      t.integer :edition_id, :null => false
      t.timestamps
    end

    change_table :songs do |t|
      t.integer :disc_id
    end

    add_foreign_key(:songs, :discs, :column => :disc_id)
    add_foreign_key(:discs, :editions, :column => :edition_id)    

  end

  def self.down
    drop_table :discs

    change_table :songs do |t|
      t.remove :disc_id
    end

  end
end
